#ifndef _H_C_CUR_THREAD_SYNC_CONTEXT_H_
#define _H_C_CUR_THREAD_SYNC_CONTEXT_H_

#include "../typedefine.h"
#include <memory>

namespace TB
{
	class ISynchronizationContext;

	class CCurThreadSyncContext
	{
	public:
		inline std::shared_ptr<ISynchronizationContext>& GetSynchronizationContext() { return m_poSynchronizationContext; }
		inline const std::shared_ptr<ISynchronizationContext>& GetSynchronizationContext() const { return m_poSynchronizationContext; }
		inline void SetSynchronizationContext(const std::shared_ptr<ISynchronizationContext>& poSynchronizationContext)
		{
			m_poSynchronizationContext = poSynchronizationContext;
		}
		inline static CCurThreadSyncContext& GetCurrent() { return m_oCurThreadSyncContext; }
	private:
		std::shared_ptr<ISynchronizationContext> m_poSynchronizationContext;
		static thread_local CCurThreadSyncContext m_oCurThreadSyncContext;
	};
}

#endif
